home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / c / reboot.c < prev    next >
Internet Message Format  |  1990-02-18  |  961b

  1. Date: Thu Feb 15 18:05:39 GMT 1990
  2. To: Info-IBMPC@WSMR-SIMTEL20.ARMY.MIL
  3. From: Mike O'Carroll <lena!mike@relay.EU.net>
  4. Subject: Reboot of PC
  5.  
  6. The program below works in TurboC (or MS C).  In some compilers, you
  7. have to fold the address to 20 bits, but here the segment and offset
  8. are separate.
  9.  
  10. Mike O'Carroll, Microsystems Unit, University of Leeds, LS2 9JT, UK
  11. E-mail: @ukc.ac.uk:mike@ee.leeds.ac.uk
  12. UUCP:   ...!mcsun!ukc!lena!mike or mike@lena.uucp
  13.  
  14. ---cut-here---
  15.  
  16. #define MAGIC           0               /* for cold restart */
  17. /* #define MAGIC           0x1234          /* for warm restart */
  18.  
  19. #define BOOT_SEG    0xffffL
  20. #define BOOT_OFF    0x0000L
  21. #define BOOT_ADR    ((BOOT_SEG << 16) | BOOT_OFF)
  22.  
  23. #define DOS_SEG        0x0040L
  24. #define RESET_FLAG    0x0072L
  25. #define RESET_ADR    ((DOS_SEG << 16) | RESET_FLAG)
  26.  
  27. main()
  28. {
  29.     void ((far *fp)()) = (void (far *)()) BOOT_ADR;
  30.  
  31.     *(int far *)RESET_ADR = MAGIC;
  32.     (*fp)();
  33.     return 0;    /* never gets here, but keeps compiler happy */
  34. }
  35.